<template>
    <IDrawer v-model="defaultValue" :loading="loading" :width="860" title="添加回调接口">
        <Form :model="data" :label-width="100" :rules="ruleValidate" ref="formCreate">
            <FormItem label="接口代码" prop="code">
                <Input v-model="data.code"></Input>
            </FormItem>
            <FormItem label="接口名称" prop="name">
                <Input v-model="data.name"></Input>
            </FormItem>
        </Form>
        <div slot="footer">
            <Button type="primary" icon="ios-add" @click="submit('formCreate')">提交</Button>
            <Button type="warning" icon="md-log-out" @click="defaultValue = false;">返回</Button>
        </div>
    </IDrawer>
</template>

<script>
    import IForm from "../../../../components/content/form";
    import contentDrawer from "../../../../mixins/contentDrawer";
    import IDrawer from "../../../../components/content/drawer";
    import IData from "./data";
    import RemoteSelect from "../../../../components/form/remoteSelect";

    export default {
        name: "create",
        mixins: [contentDrawer, IData],
        components: {RemoteSelect, IForm, IDrawer},
        data() {
            return {}
        },
        methods: {
            submit(data) {
                this.validate(data).then(() => {
                    this.loading = true;
                    this.$http.post(`system/dictionary/callback`, this.data).then(() => {
                        this.defaultValue = false;
                    }).finally(() => {
                        this.loading = false;
                    });
                });
            }
        }
    }
</script>

<style scoped>

</style>
